home *** CD-ROM | disk | FTP | other *** search
- /* $Revision Header *** Header built automatically - do not edit! ***********
- *
- * (C) Copyright 1991 by Torsten Jürgeleit
- *
- * Name .....: borders_test.c
- * Created ..: Thursday 19-Dec-91 17:26:00
- * Revision .: 0
- *
- * Date Author Comment
- * ========= ==================== ====================
- * 19-Dec-91 Torsten Jürgeleit Created this file!
- *
- ****************************************************************************
- *
- * Test of border functions
- *
- * $Revision Header ********************************************************/
-
- /* Includes */
-
- #include <exec/types.h>
- #include <graphics/gfxbase.h>
- #include <intuition/intuitionbase.h>
- #include <intuition/intuition.h>
- #ifdef AZTEC_C
- #include <functions.h> /* needed for Aztec C - prototypes and pragmas for all Amiga system functions */
- #endif
- #include <libraries/memwatch.h> /* header file for memory debug link library (Fish 240) - AFTER functions.h */
- #include "/render/render.h"
- #include "borders.h"
-
- /* Defines */
-
- #define WINDOW_WIDTH 600
- #define WINDOW_HEIGHT 180
- #define WINDOW_IDCMP CLOSEWINDOW
- #define WINDOW_FLAGS (WINDOWCLOSE | WINDOWDRAG | WINDOWDEPTH | SMART_REFRESH | NOCAREREFRESH | RMBTRAP | ACTIVATE)
- #define WINDOW_TITLE (UBYTE *)" Borders test "
-
- #define RENDER_INFO_FLAGS (USHORT)(RENDER_INFO_FLAG_INNER_WINDOW | RENDER_INFO_FLAG_BACK_FILL)
- #define OPEN_WINDOW_FLAGS (USHORT)(OPEN_WINDOW_FLAG_CENTER_SCREEN | OPEN_WINDOW_FLAG_RENDER_PENS)
-
- /* Globals */
-
- struct IntuitionBase *IntuitionBase;
- struct GfxBase *GfxBase;
- struct Library *DiskfontBase;
-
- /* Statics */
-
- STATIC struct NewWindow test_new_window = {
- 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, 0, 0, WINDOW_IDCMP, WINDOW_FLAGS,
- NULL, NULL, WINDOW_TITLE, NULL, NULL, 0, 0, 0, 0, WBENCHSCREEN
- };
- /* Defines for test borders */
-
- #define TEST_BORDER1_TYPE BORDER_DATA_TYPE_BOX1_IN
- #define TEST_BORDER1_LEFT_EDGE ((WINDOW_WIDTH - TEST_BORDER1_WIDTH) / 2)
- #define TEST_BORDER1_TOP_EDGE 20
- #define TEST_BORDER1_WIDTH (WINDOW_WIDTH / 2)
- #define TEST_BORDER1_HEIGHT (WINDOW_HEIGHT - 2 * TEST_BORDER1_TOP_EDGE)
-
- #define TEST_BORDER2_TYPE BORDER_DATA_TYPE_BOX2_IN
- #define TEST_BORDER2_LEFT_EDGE ((WINDOW_WIDTH - TEST_BORDER2_WIDTH) / 2)
- #define TEST_BORDER2_TOP_EDGE 40
- #define TEST_BORDER2_WIDTH (WINDOW_WIDTH / 3)
- #define TEST_BORDER2_HEIGHT (WINDOW_HEIGHT - 2 * TEST_BORDER2_TOP_EDGE)
-
- #define TEST_BORDER3_TYPE BORDER_DATA_TYPE_BOX1_OUT
- #define TEST_BORDER3_LEFT_EDGE ((WINDOW_WIDTH - TEST_BORDER3_WIDTH) / 2)
- #define TEST_BORDER3_TOP_EDGE 60
- #define TEST_BORDER3_WIDTH (WINDOW_WIDTH / 4)
- #define TEST_BORDER3_HEIGHT (WINDOW_HEIGHT - 2 * TEST_BORDER3_TOP_EDGE)
-
- #define TEST_BORDER4_TYPE BORDER_DATA_TYPE_BOX2_OUT
- #define TEST_BORDER4_LEFT_EDGE ((WINDOW_WIDTH - TEST_BORDER4_WIDTH) / 2)
- #define TEST_BORDER4_TOP_EDGE 80
- #define TEST_BORDER4_WIDTH (WINDOW_WIDTH / 8)
- #define TEST_BORDER4_HEIGHT (WINDOW_HEIGHT - 2 * TEST_BORDER4_TOP_EDGE)
-
- /* Statics for test borders */
-
- STATIC struct BorderData test_border_data[] = {
- {
- TEST_BORDER1_TYPE, /* bd_Type */
- TEST_BORDER1_LEFT_EDGE, /* bd_LeftEdge */
- TEST_BORDER1_TOP_EDGE, /* bd_TopEdge */
- TEST_BORDER1_WIDTH, /* bd_Width */
- TEST_BORDER1_HEIGHT /* bd_Height */
- }, {
- TEST_BORDER2_TYPE, /* bd_Type */
- TEST_BORDER2_LEFT_EDGE, /* bd_LeftEdge */
- TEST_BORDER2_TOP_EDGE, /* bd_TopEdge */
- TEST_BORDER2_WIDTH, /* bd_Width */
- TEST_BORDER2_HEIGHT /* bd_Height */
- }, {
- TEST_BORDER3_TYPE, /* bd_Type */
- TEST_BORDER3_LEFT_EDGE, /* bd_LeftEdge */
- TEST_BORDER3_TOP_EDGE, /* bd_TopEdge */
- TEST_BORDER3_WIDTH, /* bd_Width */
- TEST_BORDER3_HEIGHT /* bd_Height */
- }, {
- TEST_BORDER4_TYPE, /* bd_Type */
- TEST_BORDER4_LEFT_EDGE, /* bd_LeftEdge */
- TEST_BORDER4_TOP_EDGE, /* bd_TopEdge */
- TEST_BORDER4_WIDTH, /* bd_Width */
- TEST_BORDER4_HEIGHT /* bd_Height */
- }, {
- INTUISUP_DATA_END /* mark end of border data array */
- }
- };
- /* Prototypes */
-
- VOID test_action(struct RenderInfo *ri, struct Window *win);
-
- /* Pragmas */
-
- #pragma regcall(test_action(a0,a1))
-
- /* Borders test */
-
- LONG
- main(VOID)
- {
- struct RenderInfo *ri;
- struct Window *win;
-
- MWInit((BPTR)NULL, 0L);
- if (IntuitionBase = OpenLibrary("intuition.library", 0L)) {
- if (GfxBase = OpenLibrary("graphics.library", 0L)) {
- if (DiskfontBase = OpenLibrary("diskfont.library", 0L)) {
- if (ri = get_render_info(NULL, RENDER_INFO_FLAGS)) {
- if (win = open_window(ri, &test_new_window,
- OPEN_WINDOW_FLAGS)) {
- test_action(ri, win);
- close_window(win, FALSE);
- }
- free_render_info(ri);
- }
- CloseLibrary(DiskfontBase);
- }
- CloseLibrary(GfxBase);
- }
- CloseLibrary(IntuitionBase);
- }
- MWTerm();
- return(0L);
- }
- /* Perform IDCMP action */
-
- VOID
- test_action(struct RenderInfo *ri, struct Window *win)
- {
- struct MsgPort *up = win->UserPort;
- BOOL keepon = TRUE;
-
- display_borders(ri, win, &test_border_data[0], -0, -0);
- do {
- struct IntuiMessage *msg;
-
- WaitPort(up);
- while (msg = (struct IntuiMessage *)GetMsg(up)) {
- if (msg->Class == CLOSEWINDOW) {
- keepon = FALSE;
- }
- ReplyMsg((struct Message *)msg);
- }
- } while (keepon == TRUE);
- }
-